home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / Kubuntu 8.10 / kubuntu-8.10-desktop-i386.iso / casper / filesystem.squashfs / etc / init.d / anacron < prev    next >
Text File  |  2008-09-02  |  1KB  |  57 lines

  1. #! /bin/sh
  2. ### BEGIN INIT INFO
  3. # Provides:          anacron
  4. # Required-Start:    $remote_fs $syslog $time
  5. # Required-Stop:     $remote_fs $syslog $time
  6. # Default-Start:     2 3 4 5
  7. # Default-Stop:      0
  8. # Short-Description: Handle anac(h)ronistic cron
  9. ### END INIT INFO
  10. # /etc/init.d/anacron: start anacron
  11. #
  12.  
  13. PATH=/bin:/usr/bin:/sbin:/usr/sbin
  14.  
  15. test -x /usr/sbin/anacron || exit 0
  16.  
  17. . /lib/lsb/init-functions
  18.  
  19. case "$1" in
  20.   start)
  21.     log_daemon_msg "Starting anac(h)ronistic cron" "anacron"
  22.     if test -x /usr/bin/on_ac_power 
  23.     then
  24.         /usr/bin/on_ac_power >/dev/null
  25.         if test $? -eq 1
  26.         then
  27.           log_progress_msg "deferred while on battery power."
  28.       log_end_msg 0
  29.       exit 0
  30.         fi
  31.     fi
  32.  
  33.     # on_ac_power doesn't exist, on_ac_power returns 0 (ac power being used)
  34.     # or on_ac_power returns 255 (undefined, desktop machine without APM)
  35.     start-stop-daemon --start --exec /usr/sbin/anacron -- -s
  36.     log_end_msg 0
  37.     ;;
  38.   restart|force-reload)
  39.     # nothing to do
  40.     :
  41.     ;;
  42.   stop)
  43.     log_daemon_msg "Stopping anac(h)ronistic cron" "anacron"
  44.     start-stop-daemon --stop --exec /usr/sbin/anacron --oknodo --quiet
  45.     log_end_msg 0
  46.     ;;
  47.   status)
  48.     exit 4
  49.     ;;
  50.   *)
  51.     echo "Usage: /etc/init.d/anacron {start|stop}"
  52.     exit 2
  53.     ;;
  54. esac
  55.  
  56. exit 0
  57.